import request from '../utils/request'
/**
 * 获取用户详情
 */
export const userAdd = (data: any) => {
  return request({
    url: '/user/add',
    method: 'POST',
    data
  })
}
/**
 * 获取用户列表
 */
export const userList = (data: any) => {
  return request({
    url: '/user/list',
    method: 'POST',
    data
  })
}
/**
 * 获取用户详情
 */
export const getUserDetail = (id: string) => {
  return request({
    url: `/user/detail/${id}`
  })
}
/**
 * 删除用户
 */
export const userDelete = (id: string) => {
  return request({
    url: `/user/delete/${id}`
  })
}
/**
 * 获取指定用户的角色
 */
export const userRole = (id: string) => {
  return request({
    url: `/user/role/${id}`
  })
}
/**
 * 为用户分配角色
 */
export const updateRole = (id: string, roles: any) => {
  return request({
    url: `/user/change-role/${id}`,
    method: 'POST',
    data: roles
  })
}
/**
 * 获取用户导出数据
 */
export const userExport = () => {
  return request({
    url: '/user/export'
  })
}
/**
 * 新增户(Excel导入)
 */
export const userBatchImport = (data: any) => {
  return request({
    url: '/user/batch/import',
    method: 'POST',
    data
  })
}
